//
// Created by lingzhitech on 25-10-10.
//

#ifndef EXERCISE1318_HPP
#define EXERCISE1318_HPP
#include <string>


class Employee {
public:
    Employee(): id(++num), name(std::string()) {}
    Employee(const std::string &s = std::string()) : id(++num), name(s) {}
    Employee(const Employee& e) : id(++num), name(e.name) {}

    Employee& operator=(const Employee& e) {
        if (this != &e)
            name = e.name;  // id 不变
        return *this;
    }

    int getId() const { return id; }
    std::string getName() const { return name; }
private:
    std::string name;
    int id;
    static int num;
};
int Employee::num = 0;
#endif //EXERCISE1318_HPP
